<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	java.util.Date currTime = new java.util.Date();
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	String strTime = "";
	strTime = sdf.format(currTime);
%>

<html>
	<head>
<!---手机跳转判断开始--->
<script language="javascript">
	function firm(){
		var st = document.getElementById("status");
		if(st.value=="修改"){
			if(confirm("确定修改收入吗?")){
				event.returnValue=true;
			}else{
				event.returnValue=false;
			}
		}
	}
	(function() {
		var res = GetRequest();
		var par = res['index'];
		if (par != 'gfan') {
			var ua = navigator.userAgent.toLowerCase();
			var contains = function(a, b) {
				if (a.indexOf(b) != -1) {
					return true;
				}
			};

			var toMobileVertion = function() {
				window.location.href = 'wapnewincome.jsp';
			};

			if (contains(ua, "ipad") || (contains(ua, "rv:1.2.3.4"))
					|| (contains(ua, "0.0.0.0"))
					|| (contains(ua, "8.0.552.237"))) {
				return false;
			}
			if ((contains(ua, "android") && contains(ua, "mobile"))
					|| (contains(ua, "android") && contains(ua, "mozilla"))
					|| (contains(ua, "android") && contains(ua, "opera"))
					|| contains(ua, "ucweb") || contains(ua, "iphone")) {
				toMobileVertion();
			}
		}
	})();
	function GetRequest() {
		var url = location.search; //获取url中"?"符后的字串
		var theRequest = new Object();
		if (url.indexOf("?") != -1) {
			var str = url.substr(1);
			strs = str.split("&");
			for ( var i = 0; i < strs.length; i++) {
				theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
			}
		}
		return theRequest;
	}
</script>
		<title>收入页面</title>
		<script type="text/javascript"> 
			function IsNum(obj){
			var val = obj.value;
			obj.value = (parseInt(val) || '');
			//obj.value = one != '0'? (parseInt(val) || '') : one + (parseInt(val.substr(1,val.length)) || '');
			}
		</script>		
		<link rel="stylesheet" type="text/css" href='<s:url value="/styles.css" />'>
		<sx:head/>
	</head>
	<body>
		<s:include value="header.jsp" />
		<s:if test="#session['user'] != null">
			<div class="divNavigatorOuterFrame">
				<div class="divNavigatorInnerFrame" style="text-align: right;">
					欢迎<s:property value="#session['user'].name" />&nbsp;&nbsp;
				</div>
			</div>
			<div class="divWhiteLine"></div>
		</s:if>		
		<s:hidden name="status"/>
		<s:form action="IncomeAction_newIncome.action" theme="simple" method="post">
		<table>
			<tr>
				<td colspan="4" class="tdHeader"><s:if test="status == null">添加</s:if ><s:else><s:label name="status"/></s:else>收入</td>
				<s:hidden name="income.id"/>				
			</tr>
			<tr>
				<sx:datetimepicker type="date" name="income.incomedate" label="收入时间" displayFormat="yyyy-MM-dd" toggleType="explode" language="zh-cn"></sx:datetimepicker>
			</tr>
			<tr>
				<td class="tdFormLabel">工资(元):</td>
				<td class="tdFormControl">
					<s:textfield name="income.wage" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>wage</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">报销(元):</td>
				<td class="tdFormControl">
					<s:textfield name="income.expenseacc" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>expenseacc</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">其他(元):</td>
				<td class="tdFormControl">
					<s:textfield name="income.others" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>others</s:param></s:fielderror></font>
				</td>
				<td colspan="2">				
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">备注:</td>
				<td class="tdFormControl">
					<s:textarea colspan="2" name="income.comments" cssClass="text" />
					<font class="fonterror"><s:fielderror><s:param>comments</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td colspan="4"></td>
			</tr>
		</table>
		<table align="right">
			<tr>			
				<td><s:submit cssClass="btn" value="确定" onclick="firm()"/></td>
			</tr>
		</table>
		</s:form>
	</body>
</html>